<?php

namespace app\api\service;

use addons\epay\library\Service;

class PaymentService
{
    public static function orders($order_id,$pay_order_no, $open_id, $total_fee, $body){
        $type = 'wechat';
        $notify_url =  request()->root(true) .'/api/xyb/wx_pay/notifyx/type/'.$type.'/out_trade_no/'.$order_id;
        $return_url =  request()->root(true) .'/addons/epay/api/returnx/type/' . $type . '/out_trade_no/' . $order_id;
        return Service::submitOrder($total_fee, $pay_order_no, $type, $body, $notify_url, $return_url, 'miniapp', $open_id);
    }

    public static function reward($order_id,$pay_order_no, $open_id, $total_fee, $body){
        $type = 'wechat';
        $notify_url =  request()->root(true) .'/api/xyb/wx_pay/reward/type/'.$type.'/out_trade_no/'.$order_id;
        $return_url =  request()->root(true) .'/addons/epay/api/reward/type/' . $type . '/out_trade_no/' . $order_id;
        return Service::submitOrder($total_fee, $pay_order_no, $type, $body, $notify_url, $return_url, 'miniapp', $open_id);
    }
}